<template>
  <div class="app-container">
    <el-form :inline="true">
      <el-form-item :inline="true" label="模板标题" >
        <el-input />
      </el-form-item>

      <el-form-item label="模板类型" align="center">
        <el-select placeholder="请选择活动区域">
          <el-option label="短信" value="1"></el-option>
          <el-option label="邮件" value="2"></el-option>
          <el-option label="消息" value="3"></el-option>
          <el-option label="推送" value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-button type="primary">搜索</el-button>
    </el-form>

    <el-table :data="list" :inline="true" border >
      <el-table-column prop="templateTitle" label="模板名称" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.templateTitle}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="templateType" label="模板类型" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.templateType}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="templateName" label="模板标题" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.templateName}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="specification" label="操作" align="center">
        <el-button type="text" @click="openEdit(row)">修改</el-button>
        <el-button type="text" @click="del(row)" style="color:red">删除</el-button>
      </el-table-column>
      <el-table-column prop="specification" label="禁/启用" align="center"></el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="listQuery.currentPage"
      :limit.sync="listQuery.showCount"
      @pagination="getList"
    />
   <edit ref="edit" />
  </div>
</template>

<script>
import apinewsmodular from "@/api/frontManage/newsmodular";
import { confirm } from "@/utils/index";
import edit from "./dialogEdit";
import Pagination from "@/components/Pagination";
export default {
  name: "newsmodular",
  components: {edit,Pagination},
  data() {
    return {
      total:0,
      list: [],
      listQuery:{
          currentPage:1,
          showCount:10
      }
    };
  },
  created() {
    this.getLits();
  },
  methods: {
    getLits() {
      let data = apinewsmodular.storeTemplateList();
      this.list = data.list;
      this.total = data.page.totalResult
    },
    //删除
    del(row) {
      confirm("是否删除").then(() => {
        console.log("111");
      });
    },
    //修改
    openEdit(row){
        this.$refs.edit.open(row)
    }
  }
};
</script>

<style lang="stylus" scoped></style>